#include <iostream>
#include <algorithm>

using namespace std;

const int N = 100010;
int a[N], b[N];
int n;

int main(void)
{
    cin >> n;
    while(n--)
    {
        int len;
        cin >> len;
        int res = 0;
        for(int i = 0; i < len; i++)
        {
            cin >> a[i];
            if(a[i] < 0) res++;
        }
        
        for(int i = 0; i < len; i++) b[i] = abs(a[i]);
        
        for(int i = 0; i < res; i++) b[i] = -b[i];
        
        int i = 0;
        for(i = 0; i < len - 1; i++)
        {
            if(b[i] > b[i + 1]) 
            {
            	cout << "NO" << endl;
            	break;
			}
		}
        if(i == len - 1)
        {
        	cout << "YES" << endl;
		}      	
    }

    return 0;
}
